package com.liu.nb.controller;


import com.liu.nb.entity.Bugtype;
import com.liu.nb.util.Result;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 缺陷类型表 前端控制器
 * </p>
 *
 * @author zk
 * @since 2021-09-07
 */
@RestController
@RequestMapping("/nb/bugtype")
public class BugtypeController extends BaseController{
    //增加缺陷类型
    @PreAuthorize("hasAnyRole('root','quexianadmin')")
    @PostMapping("/add")
    public Result add(@RequestBody Bugtype bugtype){
        return Result.success(bugtypeService.save(bugtype));
    }
    //修改缺陷类型
    @PreAuthorize("hasAnyRole('root','quexianadmin')")
    @PostMapping("/upd")
    public Result upd(@RequestBody Bugtype bugtype){
        return Result.success(bugtypeService.updateById(bugtype));
    }
    //删除缺陷类型
    @PreAuthorize("hasAnyRole('root','quexianadmin')")
    @PostMapping("/del/{id}")
    public Result del(@PathVariable Integer id){
        return Result.success(bugtypeService.removeById(id));
    }
}
